module.exports = app => {
    const DataTypes = app.Sequelize;

    const Model = app.model.define('keyword', {
        id: {
            type: DataTypes.INTEGER(11).UNSIGNED,
            allowNull: false,
            primaryKey: true,
            autoIncrement: true,
        },
        shop_id: {
            type: DataTypes.INTEGER(11).UNSIGNED,
            allowNull: false,
            defaultValue: 0,
        },
        type: {
            type: DataTypes.INTEGER(11).UNSIGNED,
            allowNull: false,
            defaultValue: '0',
            comment: '类型'
        },
        keyword: {
            type: DataTypes.STRING(90),
            allowNull: false,
            defaultValue: '',
            primaryKey: true,
            comment: '关键词'
        },
        is_hot: {
            type: DataTypes.INTEGER(1).UNSIGNED,
            allowNull: false,
            defaultValue: '0',
            comment: '是否热搜'
        },
        is_default: {
            type: DataTypes.INTEGER(1).UNSIGNED,
            allowNull: false,
            defaultValue: '0',
        },
        is_show: {
            type: DataTypes.INTEGER(1).UNSIGNED,
            allowNull: false,
            defaultValue: '1',
            comment: '是否显示'
        },
        sort_order: {
            type: DataTypes.INTEGER(11).UNSIGNED,
            allowNull: false,
            defaultValue: '100',
            comment: '排序'
        },
        scheme_url: {
            type: DataTypes.STRING(255),
            allowNull: false,
            defaultValue: '',
            comment: '关键词的跳转链接'
        },
        is_delete: {
            type: DataTypes.INTEGER(1).UNSIGNED,
            allowNull: false,
            defaultValue: '0',
            comment: '是否删除，0->存在，1->删除'
        },
    }, {
        tableName: 'keyword',
        timestamps: false
    });


    Model.sync({ alter: true });

    return Model;
};
